home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / mus / misc / copyist.lha / c2txt.c < prev    next >
C/C++ Source or Header  |  1994-01-10  |  565b  |  31 lines

  1. #include "vd0:stdio.h"
  2. main(argc,argv)
  3. int argc;
  4. char *argv[];
  5. {
  6. FILE *fpin,*fpout;
  7. unsigned short x,y,z;
  8. int total,xpos,ypos;
  9. if((fpin=fopen(argv[1],"rb"))==0)  {
  10.     printf("Cannot open file %s\n",argv[1]);
  11.     exit(1);
  12.     }
  13. if((fpout=fopen(argv[2],"w"))==0)  {
  14.     printf("Cannot open file %s\n",argv[2]);
  15.     exit(1);
  16.     }
  17.   while ((x = fgetc(fpin)) != 255) {
  18.     y = fgetc(fpin);
  19.     z = fgetc(fpin);
  20.     total = ((x * 256 + y) - 3200);
  21.     ypos = (total / 160) + 1;
  22.     xpos = 161 + (total - (ypos * 160)); 
  23.     fprintf(fpout,"%3d %3d %3d\n",xpos,ypos,z);
  24.     }
  25. fclose(fpin);
  26. fclose(fpout);
  27.  
  28. }
  29.  
  30.  
  31.